home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-03 | 7.3 KB | 209 lines | [TEXT/MPS ] |
- //----------------------------------------------------------------------------------------
- // UDocumentRowSelect.cp
- // Copyright © 1991-96 by Apple Computer, Inc. All rights reserved.
- //----------------------------------------------------------------------------------------
-
- #ifndef __UDocumentRowSelect__
- #include "UDocumentRowSelect.h"
- #endif
-
- // MacApp
-
- #ifndef __UMACAPPGLOBALS__
- #include "UMacAppGlobals.h"
- #endif
-
- #ifndef __UMENUMGR__
- #include "UMenuMgr.h"
- #endif
-
- #ifndef __UPRINTING__
- #include "UPrinting.h"
- #endif
-
- #ifndef __UVIEWSERVER__
- #include "UViewServer.h"
- #endif
-
- #ifndef __UWINDOW__
- #include "UWindow.h"
- #endif
-
- //----------------------------------------------------------------------------------------
- // Constants:
-
- const ResNumber kRowSelectWindowID = kDefaultWindowID;
-
- //========================================================================================
- // CLASS TDocumentRowSelect
- //========================================================================================
- #undef Inherited
- #define Inherited TFileBasedDocument
-
- #pragma segment AOpen
- MA_DEFINE_CLASS_M1(TDocumentRowSelect, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TDocumentRowSelect constructor
- //----------------------------------------------------------------------------------------
- #pragma segment AOpen
-
- TDocumentRowSelect::TDocumentRowSelect()
- {
- } // TDocumentRowSelect::TDocumentRowSelect
-
- //----------------------------------------------------------------------------------------
- // TDocumentRowSelect::IDocumentRowSelect:
- //----------------------------------------------------------------------------------------
- #pragma segment AOpen
-
- void TDocumentRowSelect::IDocumentRowSelect(TFile* itsFile,
- OSType itsCreator)
- {
- this->IFileBasedDocument(itsFile,itsCreator);
- } // TDocumentRowSelect::IDocumentRowSelect
-
- //----------------------------------------------------------------------------------------
- // TDocumentRowSelect destructor
- //----------------------------------------------------------------------------------------
- #pragma segment AClose
-
- TDocumentRowSelect::~TDocumentRowSelect()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TDocumentRowSelect::FreeData:
- //----------------------------------------------------------------------------------------
- #pragma segment AClose
-
- void TDocumentRowSelect::FreeData() // Override
- {
- Inherited::FreeData();
- } // TDocumentRowSelect::FreeData
-
- //----------------------------------------------------------------------------------------
- // TDocumentRowSelect::DoInitialState:
- //----------------------------------------------------------------------------------------
- #pragma segment AOpen
-
- void TDocumentRowSelect::DoInitialState() // Override
- {
- Inherited::DoInitialState();
- } // TDocumentRowSelect::DoInitialState
-
- //----------------------------------------------------------------------------------------
- // TDocumentRowSelect::DoMakeViews:
- //----------------------------------------------------------------------------------------
- #pragma segment AOpen
-
- void TDocumentRowSelect::DoMakeViews(Boolean /*forPrinting*/) // Override
- {
- TWindow* aWindow = NULL;
- TStdPrintHandler* aHandler = NULL;
- TView* aView = NULL;
-
- FailNIL(aWindow = gViewServer->NewTemplateWindow(kRowSelectWindowID, this));
-
- /* You will likely have a different view to which you would like to
- attach a print handler. */
- aView = aWindow->FirstSubView();
-
- aHandler = new TStdPrintHandler;
- aHandler->IStdPrintHandler(this, // its document
- aView, // its view
- !kSquareDots, // does not have square dots
- kFixedSize, // horzontal page size is fixed
- kFixedSize); // vertical page size is fixed
- } // TDocumentRowSelect::DoMakeViews
-
- //----------------------------------------------------------------------------------------
- // TDocumentRowSelect::DoNeedDiskSpace:
- //----------------------------------------------------------------------------------------
- #pragma segment AWriteFile
-
- void TDocumentRowSelect::DoNeedDiskSpace(TFile* itsFile,
- long& dataForkBytes,
- long& rsrcForkBytes) // Override
- {
- Inherited::DoNeedDiskSpace(itsFile, dataForkBytes, rsrcForkBytes);
- } // TDocumentRowSelect::DoNeedDiskSpace
-
- //----------------------------------------------------------------------------------------
- // TDocumentRowSelect::DoMenuCommand: This method is overridden to handle menu items which
- // are enabled when this document is in the target chain. In this example, this is true
- // when the document is open and its window is the active window. The inherited method
- // should always be called so that MacApp can allow successor objects in the target chain
- // (i.e. the application) to handle THEIR menu items.
- //----------------------------------------------------------------------------------------
- #pragma segment ASelCommand
-
- void TDocumentRowSelect::DoMenuCommand(CommandNumber aCommandNumber) // Override
- {
- switch (aCommandNumber)
- {
- /* Typically, you will have dispatch your own menu commands here:
- case cCommandHandledByDocument:
- {
- TCommandRowSelect* aCommand = new TCommandRowSelect;
- aCommand->ICommandRowSelect(aCommandNumber, this);
- this->PostCommand(aCommand);
- }
- break;
- */
- default:
- Inherited::DoMenuCommand(aCommandNumber);
- break;
- }
- } // TDocumentRowSelect::DoMenuCommand
-
- //----------------------------------------------------------------------------------------
- // TDocumentRowSelect::DoRead:
- //----------------------------------------------------------------------------------------
- #pragma segment AReadFile
-
- void TDocumentRowSelect::DoRead(TFile* aFile,
- Boolean forPrinting) // Override
- {
- Inherited::DoRead(aFile,forPrinting);
- } // TDocumentRowSelect::DoRead
-
- //----------------------------------------------------------------------------------------
- // TDocumentRowSelect::DoSetupMenus: This method is overridden to enable menu items which
- // should be enabled when this object is in the target chain. MacApp initially disables
- // all menu items, then lets the objects in the target chain enable those items they
- // handle.
- //
- // A document object is in the target chain when its window is the active window.
- //
- // The inherited method is called so that TDocument can enable document-level menu items
- // like "Save ". This also ensures that objects further up the target chain (the
- // application) can set up THEIR menus.
- //----------------------------------------------------------------------------------------
- #pragma segment ARes
-
- void TDocumentRowSelect::DoSetupMenus() // Override
- {
- Inherited::DoSetupMenus();
-
- /* Typically, you will have enable your own menu commands here:
- Enable(cCommandHandledByDocument,TRUE);
- */
- } // TDocumentRowSelect::DoSetupMenus
-
- //----------------------------------------------------------------------------------------
- // TDocumentRowSelect::DoWrite:
- //----------------------------------------------------------------------------------------
- #pragma segment AWriteFile
-
- void TDocumentRowSelect::DoWrite(TFile* aFile,
- Boolean makingCopy) // Override
- {
- Inherited::DoWrite(aFile,makingCopy);
- } // TDocumentRowSelect::DoWrite
-
- //----------------------------------------------------------------------------------------
- // End of UDocumentRowSelect.cp
-
- #pragma segment Inline
-